package com.itboye.jigongbao.adpapter

import android.content.Context
import com.itboye.jigongbao.R
import com.itboye.jigongbao.adpapter.baseAdapter.MutiplyCommonAdapter
import com.itboye.jigongbao.adpapter.baseAdapter.ViewHolder
import com.itboye.jigongbao.bean.JiYiBiBean
import com.itboye.jigongbao.utils.Const
import com.itboye.jigongbao.utils.SPUtils

/**
 * Created by Administrator on 2017/11/29.
 */
class JiYiBiListAdapter(context: Context, datas: List<JiYiBiBean.JiYiBiEntity>, vararg layoutId: Int) : MutiplyCommonAdapter<JiYiBiBean.JiYiBiEntity>(context, datas, layoutId[0]) {

    var context: Context? = null

    init {
        this.context = context
    }

    override fun getItemViewType(position: Int): Int {
        return 0
    }

    override fun getItemPosition(position: Int) {
    }

    override fun convert(holder: ViewHolder?, t: JiYiBiBean.JiYiBiEntity, type: Int, position: Int) {

        var role = SPUtils.getSp(Const.ROLE) as String
        when (role) {
            Const.WORKER -> {
                holder!!.setText(R.id.txt_jiyibi_list_name, t.overseer_name)
            }
            Const.FORCEMAN -> {

                holder!!.setText(R.id.txt_jiyibi_list_name, t.worker_name)
            }
        }
        holder!!.setText(R.id.txt_jiyibi_list_shouru, "" + t.money / 100)
        when (t.audit_status) {
            0 -> {
                //待审核
                holder!!.setText(R.id.txt_jiyibi_list_status, "待审查")
                holder!!.setTextColor(R.id.txt_jiyibi_list_status, context!!.resources.getColor(R.color.main_blue))
            }
            1 -> {
                //审核通过
                holder!!.setText(R.id.txt_jiyibi_list_status, "已审查")
                holder!!.setTextColor(R.id.txt_jiyibi_list_status, context!!.resources.getColor(R.color.gray_B3))
            }
            2 -> {
                //存疑
                holder!!.setText(R.id.txt_jiyibi_list_status, "存疑")
                holder!!.setTextColor(R.id.txt_jiyibi_list_status, context!!.resources.getColor(R.color.gallery_red))
            }
            else -> {
            }
        }
    }
}